<template>
  <footer>
    <p>©2021 My Blog</p>
    <p>勉强运行：{{ runTime }}</p>
  </footer>
</template>

<script>
export default {
  name: 'Footer',
  mounted () {
    setInterval(this.getRunTime, 1000)
  },
  data () {
    return {
      runTime: ''
    }
  },
  methods: {
    getRunTime () {
      const time = new Date().getTime() - Date.parse('2021-02-17 21:58:00')
      this.runTime = `${parseInt(time / (24 * 3600 * 1000))}天${parseInt((time % (24 * 3600 * 1000)) / (3600 * 1000))}时
      ${parseInt((time % (3600 * 1000)) / (60 * 1000))}分${parseInt((time % (60 * 1000)) / 1000)}秒`
    }
  }
}
</script>

<style lang="scss">
footer {
  clear: both;
  margin-top: 30px;
  padding-bottom: 20px;
  text-align: center;
  color: #b9b9b9;
  font-size: 14px;
  font-family: "Comic Sans MS",serif;
  padding-top: 20px;
}
</style>
